using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace MTRC.ODMS.Web.SOM.Popup
{
    /// <summary>
    /// author:Huangyao
    /// </summary>
    public partial class PopupLossDamage : BasePage_SOM
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.SetLanguage();
            }

            //function OpenLossDamageForm(NumOfLoanItem, ItemDescription, NumOfLossItem, Remark)
            string numOfLoanItem = Request.QueryString["NumOfLoanItem"].ToString();
            string itemDescription = HttpUtility.UrlDecode(Request.QueryString["ItemDescription"].ToString());
            string numOfLossItem = Request.QueryString["NumOfLossItem"].ToString();
            string remark = HttpUtility.UrlDecode(Request.QueryString["Remark"].ToString());

            string hdnLossDamageQtyControlName = Request.QueryString["hdnLossDamageQtyControlName"].ToString();
            string hdnLossDamageRemarkControlName = Request.QueryString["hdnLossDamageRemarkControlName"].ToString();

            this.lblLoanItemVal.Text = itemDescription;
            this.txtNumOfLossItem.Text = numOfLossItem;
            this.txtLossDamageRemark.Text = remark;
            this.hdnNumOfLoanItem.Value = numOfLoanItem;
            bool isReadOnly = false;
            if (Request.QueryString["isReadOnly"].ToString().Trim().ToLower() == "true")
            {
                isReadOnly = true;
            }

            this.txtNumOfLossItem.Enabled = ! isReadOnly;
            this.txtLossDamageRemark.Enabled = !isReadOnly;
            this.btnCancel.Visible = !isReadOnly;
            this.btnOK.Visible = !isReadOnly;
            this.btnClose.Visible = isReadOnly;

            string strLossQtyLargeThanZeroMsg = this.GetMessage("SOM_LossQtyShouldLargeThanZeroMsg");
            string strLossQtyShouldLessThanLoanQtyMsg = this.GetMessage("SOM_LossQtyShouldLargeThanZeroMsg");
            this.btnOK.Attributes.Add("onclick", "javascript:return btnOKClick('" + strLossQtyLargeThanZeroMsg + "', '" + strLossQtyShouldLessThanLoanQtyMsg + "', '" + hdnLossDamageQtyControlName + "' ,'" + hdnLossDamageRemarkControlName + "');");
        }

        protected void btnOK_Click(object sender, EventArgs e)
        { 
        
        }

        protected void btnCancel_Click(object sender, EventArgs e)
        { 
        
        }

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            this.ChangeLanguage += new ChangeLanguageEventHandler(ChangeLanguage_Function);
        }

        void ChangeLanguage_Function(object sender, EventArgs e)
        {
            SetLanguage();
        }

        private void SetLanguage()
        {
            //lblAssetLoanSectionName
            this.lblLoanItemLbl.Text = this.GetLabel("SOM_LossDamageLoanItemLbl", true);
            this.lblNumOfLossItemLbl.Text = this.GetLabel("SOM_LossDamageLossItemLbl", true);
            this.lblRemark.Text = this.GetLabel("SOM_Remark", true);

            this.btnOK.Text = this.GetLabel("COM_Submit");
            this.btnCancel.Text = this.GetLabel("COM_Cancel");
            this.btnClose.Text = this.GetLabel("COM_Close");
        }
    }
}
